 /**
 * Description: 统计分析
 * @author:jacky
 * @since:1.0.0
 *
 * Modification History:
 * Date         Author      Version     Description
 * ------------------------------------------------------------------
 * 2018-05-15   jacky       1.0.0     Initial
 */
package com.metro.demo.analysis.service.impl;

import com.metro.core.dao.IMapper;
import com.metro.core.service.BaseServiceSupport;
import com.metro.core.service.ServiceException;
import com.metro.core.vo.ResultCode;
import com.metro.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.metro.demo.analysis.mapper.IBizStatisticalAnalysisMapper;
import com.metro.demo.analysis.service.inf.IBizStatisticalAnalysisService;
import com.metro.demo.analysis.beans.vo.BizStatisticalAnalysis;

 /**
 * 统计分析<br>
 *
 * @author:jacky
 * @since:1.0.0
 * @version [1.0.0, 2018-05-15]
 */
@Service("bizstatisticalanalysisService")
public class BizStatisticalAnalysisService extends BaseServiceSupport<BizStatisticalAnalysis> implements IBizStatisticalAnalysisService{
    //统计分析Mapper
    @Autowired
    private IBizStatisticalAnalysisMapper bizstatisticalanalysisMapper;

    @Override
    public IMapper getMapper() {
        return bizstatisticalanalysisMapper;
    }

    @Override
    public IResult save(BizStatisticalAnalysis entity) {
        try {
            bizstatisticalanalysisMapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增统计分析失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(BizStatisticalAnalysis entity) {
        try {
            bizstatisticalanalysisMapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改统计分析失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            bizstatisticalanalysisMapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            bizstatisticalanalysisMapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
}